#3053 Fix by using custom bool parsing that if a string is found then…#3054
#3053 Fix by using custom bool parsing that if a string is found then…#3054souvikghosh04 merged 31 commits intoAzure:mainfrom
Conversation
… then it uses the environment replacement and looks for a true false 1 or 0.
There was a problem hiding this comment.
Pull request overview
This pull request fixes issue #3053 by enabling boolean configuration values to be set using environment variables. Previously, boolean values could not use environment variable substitution like string values could.
Changes:
- Added a custom
BoolJsonConverterthat handles boolean deserialization from both native JSON boolean tokens and string tokens (which enables environment variable substitution) - Registered the new converter in the JSON serialization pipeline
- Added unit tests to validate boolean values can be set through environment variables
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
| src/Config/Converters/BooleanJsonConverterFactory.cs | New custom JSON converter that deserializes boolean values from both JSON booleans and strings, enabling environment variable substitution |
| src/Config/RuntimeConfigLoader.cs | Registers the BoolJsonConverter in the serialization options |
| src/Service.Tests/UnitTests/RuntimeConfigLoaderJsonDeserializerTests.cs | Adds test coverage for boolean environment variable replacement |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/Service.Tests/UnitTests/RuntimeConfigLoaderJsonDeserializerTests.cs
Outdated
Show resolved
Hide resolved
src/Service.Tests/UnitTests/RuntimeConfigLoaderJsonDeserializerTests.cs
Outdated
Show resolved
Hide resolved
src/Service.Tests/UnitTests/RuntimeConfigLoaderJsonDeserializerTests.cs
Outdated
Show resolved
Hide resolved
src/Service.Tests/UnitTests/RuntimeConfigLoaderJsonDeserializerTests.cs
Outdated
Show resolved
Hide resolved
…rTests.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…rTests.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
I think this is now catered for it you mean where the json is the following. and also |
|
I am not sure this resolves JSON Schema constraints/editing errors, does it? |
@JerryNixon It doesn't but I've just pushed change to the schema that would. If thats an acceptable approach I can apply to other booleans. Interestinlythere does seem to be a mix of json schema validation jsonconverter validation. The jsonconverter stuff looks overly complicated. for some simple serialisation. |
|
/azp run |
|
Azure Pipelines successfully started running 6 pipeline(s). |
souvikghosh04
left a comment
There was a problem hiding this comment.
Approved with suggestions.
|
/azp run |
|
Azure Pipelines successfully started running 6 pipeline(s). |
souvikghosh04
left a comment
There was a problem hiding this comment.
some tests are failing which is blocking the merge. please ensure to run and validate the tests locally. for example- ..\CosmosTests\SchemaGeneratorTest.cs has multiple failing tests.
…on files being CRLF line endings.
|
Tests were failing due to inconsistencies with CR and LF endings. |
|
/azp run |
|
Azure Pipelines successfully started running 6 pipeline(s). |
souvikghosh04
left a comment
There was a problem hiding this comment.
Approving latest test fixes
|
Are these test failues transient? |
#3054) … it uses the environment replacement and looks for a true false 1 or 0. ## Why make this change? Fixes #3053 Boolean values can't be set using environment variables. This allows that ## What is this change? Using custom JsonConverter for bools that if a string is detected it uses the string serialiser that uses the environment replacement rules. ## How was this tested? - [ ] Integration Tests - [x] Unit Tests --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Jerry Nixon <1749983+JerryNixon@users.noreply.github.com> Co-authored-by: Aniruddh Munde <anmunde@microsoft.com>
…w boolean properties to be set by env vars (#3092) ## Why make this change? - Server level description is an important field in MCP configuration. This should be included in release 1.7. - Fix to allow boolean properties to be set by environment variables is a requested change. ## What is this change? - Cherry picks #3016 and - #3054 ## How was this tested? PR Pipeline validation. --------- Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: JerryNixon <1749983+JerryNixon@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: anushakolan <45540936+anushakolan@users.noreply.github.com> Co-authored-by: Anusha Kolan <anushakolan10@gmail.com> Co-authored-by: Simon Sabin <1209963+simonsabin@users.noreply.github.com>
… it uses the environment replacement and looks for a true false 1 or 0.
Why make this change?
Fixes #3053
Boolean values can't be set using environment variables. This allows that
What is this change?
Using custom JsonConverter for bools that if a string is detected it uses the string serialiser that uses the environment replacement rules.
How was this tested?